package com.xuecheng.media.jobhandler;

import com.xxl.job.core.context.XxlJobHelper;
import com.xxl.job.core.handler.annotation.XxlJob;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

/**
 * @author hjh
 * @Description TODO
 * @since 2023/5/9
 */

@Slf4j
@Component
public class SimpleJob {

    @XxlJob("testJob")
    void testJob(){
        log.info("测试定时任务");
    }

    @XxlJob("shardingJob")
    void shradingJob(){
        int shardIndex = XxlJobHelper.getShardIndex();
        int shardTotal = XxlJobHelper.getShardTotal();

        log.info("分片参数：当前分片序号 = {}, 总分片数 = {}", shardIndex, shardTotal);
        log.info("开始执行第"+shardIndex+"批任务");

    }
}
